package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"
)

// START OMIT
func curl(url string) (string, error) {
	resp, err := http.Get(url)
	if err != nil {
		// local handling
		log.Printf("failed to fetch url %q: %v", url, err)
		// forward error to caller
		return "", err
	}
	defer resp.Body.Close()
	// ignore error
	data, _ := ioutil.ReadAll(resp.Body)
	return string(data), nil
}
// STOP COMIT

func main() {
	data, err := curl("foo.com")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
	fmt.Println(data)
}
